use "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\2019-05-07 final data liberal peace.dta", replace
log using "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\2019-05-07 final log.smcl", replace

//Figure 1
//Individual Bar Graphs
 graph hbar (lastnm) libpeace_provision if year_10_last==1, over(country_accorddate)blabel(bar)
 graph hbar (lastnm) libpeace_imprate_strict if year_10_last==1, over(country_accorddate)blabel(bar)
graph hbar (lastnm) libpeace_impleRate if year_10_last==1, over(country_accorddate)blabel(bar, format(%2.0f))
 //graph combine  "C:\Users\mjoshi2\Google Drive\2017 Projects\Liberal Peace Implementation\prov.gph" "C:\Users\mjoshi2\Google Drive\2017 Projects\Liberal Peace Implementation\Strict1.gph" "C:\Users\mjoshi2\Google Drive\2017 Projects\Liberal Peace Implementation\Lenient1.gph", col(3)
 


//armed conflict between signatories
stset year_count, id(caseid) failure( sig_minor_war) origin(time year_count)

sum sig_minor_war gdp_growth_annual_perc libpeace_impleRate libpeace_provision non_libprov libpeace_imprate_strict batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type total_dead_1000 armed_personnel1000 if  exclude_cases==0

//Pairwise correlation Tests
pwcorr elect_implem const_implem  truth_implem  dispute_implem  judrfm_implem  humrts_implem  refug_implem  idps_implem  indmin_implem  minrts_implem women_implem child_implem cultr_implem milrfm_implem demob_implem disarm_implem  reint_implem powtran_implem civadm_impem  polrfm_implem exerefm_implem  legref_implem decen_implem, star(0.05)

//Table 3
//Lenient Models

//Model 1
streg  libpeace_impleRate if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 2
streg  libpeace_impleRate batt_deaths_allwars_1000  war_dur  infant_rate  ln_media  if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 3
streg  libpeace_impleRate batt_deaths_allwars_1000  war_dur  infant_rate  ln_media  unpkf_prov  verify_prov  if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 4
streg   libpeace_impleRate batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time
//new model 5, includes gdp growth rate
streg  libpeace_impleRate gdp_growth_annual_perc batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 5, this is now 6
streg   libpeace_impleRate total_dead_1000 war_dur  infant_rate  ln_media   armed_personnel1000 unpkf_prov  ex_constrain5_7 if  exclude_cases==0, cluster (cowcode) d(w) time


//Strict Models
//Model 1
streg  libpeace_imprate_strict if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 2
streg  libpeace_imprate_strict  batt_deaths_allwars_1000  war_dur  infant_rate  ln_media  if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 3
streg  libpeace_imprate_strict  batt_deaths_allwars_1000  war_dur  infant_rate  ln_media  unpkf_prov  verify_prov  if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 4
streg   libpeace_imprate_strict batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time

//new Model 5, includes gdp growth rate
streg  libpeace_imprate_strict gdp_growth_annual_perc  batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time

//Model 5, this is now 6
streg   libpeace_imprate_strict total_dead_1000 war_dur  infant_rate  ln_media   armed_personnel1000 unpkf_prov  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time


//Table 4 Model 13
streg  libpeace_impleRate libpeace_provision non_libprov total_dead_1000 war_dur  infant_rate  ln_media   armed_personnel1000  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time
//Table 4 Model 14
streg   libpeace_imprate_strict libpeace_provision non_libprov total_dead_1000 war_dur  infant_rate  ln_media   armed_personnel1000  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time





//Figure 2 six graphs

//Combine Graphs for EL Salvador, Mozambique, Bangladesh, PNG, Liberia and Cambodia
line  libpeace_impleRate year_count if  exclude_cases!=1 & caseid==2, title("El Salvador")
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\elsalvador.gph", replace
line  libpeace_impleRate year_count if  exclude_cases!=1 & caseid==22, title("Mozambique")
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\mozambique.gph", replace
line  libpeace_impleRate year_count if  exclude_cases!=1 & caseid==28, title("Bangladesh")
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\bangladesh.gph", replace
line  libpeace_impleRate year_count if  exclude_cases!=1 & caseid==34, title("Papua New Guinea")
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\png.gph", replace
line  libpeace_impleRate year_count if  exclude_cases!=1 & caseid==12, title("Liberia")
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\liberia.gph", replace
line  libpeace_impleRate year_count if  exclude_cases!=1 & caseid==30, title("Cambodia")
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\cambodia.gph", replace


graph combine "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\elsalvador.gph" "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\mozambique.gph" "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\bangladesh.gph" "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\png.gph" "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\liberia.gph" "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\cambodia.gph", ycommon

//Figure 3 Survival curve
streg   libpeace_impleRate batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type if  exclude_cases==0, cluster (cowcode) d(w) time
//ONLY Liberal Peace
stcurve, survival at1(libpeace_impleRate=0) at2(libpeace_impleRate=25) at3(libpeace_impleRate=50) at4(libpeace_impleRate=75)
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\F1.gph", replace


//Liberal Peace with UN Mission  
stcurve, survival at1(libpeace_impleRate=0 unpkf_prov = 1) at2(libpeace_impleRate=25 unpkf_prov = 1) at3(libpeace_impleRate=50 unpkf_prov =1) at4(libpeace_impleRate=75 unpkf_prov =1)
graph save Graph "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\F2.gph", replace

graph combine "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\F1.gph" "C:\Users\mjoshi2\Box\2019-MJ-Home-Work\Article III\Final Data\F2.gph", ycommon 

log close




//Final data
keep cowcode country year_10_last exclude_cases country_accorddate elect_implem const_implem  truth_implem  dispute_implem  judrfm_implem  humrts_implem  refug_implem  idps_implem  indmin_implem  minrts_implem women_implem child_implem cultr_implem milrfm_implem demob_implem disarm_implem  reint_implem powtran_implem civadm_impem  polrfm_implem exerefm_implem  legref_implem decen_implem  year_count caseid sig_minor_war year country country_accorddate sig_minor_war gdp_growth_annual_perc libpeace_impleRate libpeace_provision non_libprov libpeace_imprate_strict batt_deaths_allwars_1000  war_dur  infant_rate  ln_media   verify_prov unpkf_prov  ex_constrain5_7 conflict_type total_dead_1000 armed_personnel1000  



